//
//  YZEAddSuifangViewController.m
//  yilutongxing
//
//  Created by T&J on 2017/6/28.
//  Copyright © 2017年 YZE. All rights reserved.
//

#import "YZEAddSuifangViewController.h"
#import "YZESuifangGanzangTableViewController.h"
#import "YZESuifangShenzangTableViewController.h"
#import "YZEGanzangCheckViewController.h"
#import "YZEShenzangCheckViewController.h"

@interface YZEAddSuifangViewController ()
@property(nonatomic, strong) NSArray *optionArr;//选择项目
@end

@implementation YZEAddSuifangViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"选择移植随访类型";
    self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
    self.clearsSelectionOnViewWillAppear = YES;
    
    self.optionArr = @[@"肝脏移植随访", @"肾脏移植随访", @"肝脏移植检查", @"肾脏移植检查"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _optionArr.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    cell.textLabel.text = _optionArr[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewController *v;
    switch (indexPath.row) {
        case 0:
            v = [[YZESuifangGanzangTableViewController alloc]initWithType:YES];
            break;
        case 1:
            v = [[YZESuifangShenzangTableViewController alloc]initWithType:YES];
            break;
        case 2:
        {
            UIStoryboard *sb = [UIStoryboard storyboardWithName:@"suifangAndCheck" bundle:[NSBundle mainBundle]];
            v = [sb instantiateViewControllerWithIdentifier:@"liverCheckVC"];
            ((YZEGanzangCheckViewController*)v).isAdd = YES;
        }
            break;
        case 3:
        {
            UIStoryboard *sb = [UIStoryboard storyboardWithName:@"suifangAndCheck" bundle:[NSBundle mainBundle]];
            v = [sb instantiateViewControllerWithIdentifier:@"renalCheckVC"];
            ((YZEShenzangCheckViewController*)v).isAdd = YES;
        }
            break;
        default:
            break;
    }
    
    [self.navigationController pushViewController:v animated:YES];
}


/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
